package excercise;

import java.util.Scanner;

public class EX05_Q32 {

	public static void main(String[] args) {
		
		
		
	// 반복문으로 처리
	int tot;
	int key;
	long jumin = 1234561234567L;
	tot = 0;
	for ( long divider = 1000000000000L, prime = 2 ; 
			divider >= 10L; divider /=10, ++prime) {
				if ( prime > 9 ) prime = 2;
				key = (int) ( jumin / divider);
				tot = tot + ( key * (int) prime );
				if ( key > 0 ) jumin = jumin % ( key * divider );
		}
		System.out.println( jumin);
		System.out.println( (11 - tot % 11) % 10 );	
		
		
		
		
	JuminVO jvo = new JuminVO();
	Scanner sc = new Scanner(System.in);	
	long tmp;
	
	System.out.println("주민번호를 입력해주세요 : ");
	tmp = sc.nextLong();
	jvo.setMyJuminNum( tmp );
	jvo.setFirstJumin( jvo.getMyJuminNum() );
	jvo.setLastJumin( jvo.getMyJuminNum() );
	
	System.out.println( jvo.getFirstJumin());
	System.out.println( jvo.getLastJumin());
	
	JuminService.juminTrue( jvo );
		
	} //main

} // class

class JuminVO{
	private long myJuminNum;
	private long firstJumin;
	private long lastJumin;
	int operater;
	
	public JuminVO() {
				
	}
	
	// myJuminNum SG
	public void setMyJuminNum ( long myjuminNum ) { this.myJuminNum = myjuminNum; }
	public long getMyJuminNum () { return this.myJuminNum; }
	
	// operater getter
	public int getOperater ( ) { return this.operater; }
	
	
	public void setFirstJumin ( long myJuminNum) { this.firstJumin = (long )myJuminNum / 10000000; }
	public long getFirstJumin () { return this.firstJumin; }
	
	public void setLastJumin ( long myJuminNum) { this.lastJumin = (long )myJuminNum % 10000000; }
	public long getLastJumin () { return this.lastJumin; }
	
	
	
} // JuminVO

class JuminService{
	
	static void juminTrue( JuminVO jvo ){
		int key;
		int tot = 0;
		int laNum = 0;
		int[] operater = { 2, 3, 4, 5, 6, 7, 8 , 9, 2, 3, 4, 5};
		tot += ( (int) jvo.getFirstJumin() / 100000 ) * operater[0] ; 	
		tot += ( (int) jvo.getFirstJumin() % 100000 / 10000) * operater[1] ; 	
		tot += ( (int) jvo.getFirstJumin() % 100000 % 10000 / 1000 ) * operater[2] ; 	
		tot += ( (int) jvo.getFirstJumin() % 100000 % 10000 % 1000 / 100 ) * operater[3] ; 	
		tot += ( (int) jvo.getFirstJumin() % 100000 % 10000 % 1000 % 100 / 10) * operater[4] ; 	
		tot += ( (int) jvo.getFirstJumin() % 100000 % 10000 % 1000 % 100 % 10 ) * operater[5] ; 	
		tot += ( (int) jvo.getLastJumin() / 1000000 ) * operater[6] ;
		tot += ( (int) jvo.getLastJumin() % 1000000 / 100000 ) * operater[7] ;
		tot += ( (int) jvo.getLastJumin() % 1000000 % 100000 / 10000 ) * operater[8] ;
		tot += ( (int) jvo.getLastJumin() % 1000000 % 100000 % 10000 / 1000 ) * operater[9] ;
		tot += ( (int) jvo.getLastJumin() % 1000000 % 100000 % 10000 % 1000 / 100 ) * operater[10] ;
		tot += ( (int) jvo.getLastJumin() % 1000000 % 100000 % 10000 % 1000 % 100 / 10 ) * operater[11] ;

		
		System.out.println( Math.pow(10, 3));
		
		
	
		
		
		
		
		
		
		
		laNum = (int) jvo.getLastJumin() % 1000000 % 100000 % 10000 % 1000 % 100 % 10 ;
				
		int repeir = (11 - tot % 11) % 10 ;
		
			if ( repeir == laNum ) {
			System.out.println( "정상입니다");
		}
		else {
			System.out.println( "뻥카치지 말라고!!!");
		}
			
		
	}
		
} // JuminService
	











